package com.hjsmallfly.syllabus.base

import rx.Subscription
import rx.subscriptions.CompositeSubscription

class Disposed : IDisposed {

    private val compositeSubscription = CompositeSubscription()

    override fun add(disposed: Subscription) {
        compositeSubscription.add(disposed)
    }

    override fun diposed() {
        if (compositeSubscription.isUnsubscribed) {
            compositeSubscription.clear()
        }
    }
}